<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Spring Boot API 调用示例</title>
</head>
<body>
<h1>Spring Boot API 调用</h1>

<button onclick="vivogpt()">蓝心</button>
<button onclick="geo()">地理编码</button>
<button onclick="task_submit()">AI绘画 1. 提交作画任务</button>
<button onclick="taskProgress()">AI绘画 2. 查询作画任务</button>
<button onclick="taskCancel()">AI绘画 3. 取消绘画任务</button>
<button onclick="predict()">文本向量</button>
<button onclick="translation()">文本翻译</button>

<div id="result"></div>

<script>
    function vivogpt() {
        fetch('/test/vivogpt')
            .then(response => response.text())
            .then(text => {
                document.getElementById('result').innerText = text;
            })
            .catch(error => {
                document.getElementById('result').innerText = '请求失败：' + error;
            });
    }

    function geo() {
        fetch('/test/geo')
            .then(response => response.text())
            .then(text => {
                document.getElementById('result').innerText = text;
            })
            .catch(error => {
                document.getElementById('result').innerText = '请求失败：' + error;
            });
    }

    function task_submit() {
        fetch('/test/task')
            .then(response => response.text())
            .then(text => {
                document.getElementById('result').innerText = text;
            })
            .catch(error => {
                document.getElementById('result').innerText = '请求失败：' + error;
            });
    }

    function taskProgress() {
        fetch('/test/taskProgress')
            .then(response => response.text())
            .then(text => {
                document.getElementById('result').innerText = text;
            })
            .catch(error => {
                document.getElementById('result').innerText = '请求失败：' + error;
            });
    }

    function taskCancel() {
        fetch('/test/taskCancel')
            .then(response => response.text())
            .then(text => {
                document.getElementById('result').innerText = text;
            })
            .catch(error => {
                document.getElementById('result').innerText = '请求失败：' + error;
            });
    }

    function predict() {
        fetch('/test/predict')
            .then(response => response.text())
            .then(text => {
                document.getElementById('result').innerText = text;
            })
            .catch(error => {
                document.getElementById('result').innerText = '请求失败：' + error;
            });
    }

    function translation() {
        fetch('/test/translation')
            .then(response => response.text())
            .then(text => {
                document.getElementById('result').innerText = text;
            })
            .catch(error => {
                document.getElementById('result').innerText = '请求失败：' + error;
            });
    }
</script>
</body>
</html>